#ifndef __ATTRIBUTE_INFO_H__
#define __ATTRIBUTE_INFO_H__

#include <vector>
#include <fstream>
#include "cp_info.h"
using namespace std;

class attribute_info {
public:
	short attribute_name_index;
	int   attribute_length;
public:
	static attribute_info* create(char* &buffer, vector<cp_info*> constant_pool) ;
};

class sourcefile_attribute : public attribute_info{
public:
	short sourcefile_index;
};

class constant_value_attribute : public attribute_info {
public:
	short constantvalue_index;
};

class code_attribute : public attribute_info {
public:
	short max_stack;
	short max_locals;
	int code_length;
	vector<char> code;
	short exception_table_length;
	class exception_table_c{
	public:
		short start_pc;
		short end_pc;
		short handler_pc;
		short catch_type;
	};
	vector<exception_table_c*> exception_table;
	short attributes_count;
	vector<attribute_info*> attributes;
};

class exceptions_attribute :public attribute_info {
public:
	short number_of_exceptions;
	vector<short> exception_index_table;
};

class line_number_table_attribute : public attribute_info {
public:
	short line_number_table_length;
	class line_number_table_c {
	public:
		short start_pc;
		short line_number;
	};
	vector<line_number_table_c*> line_number_table;
};

class inner_classes_attriubte : public attribute_info {
public:
	class classes_c{
	public:
		short inner_class_info_index;
		short outer_class_info_index;
		short inner_name_index;
		short inner_class_access_flags;
	};
	short number_of_classes;
	vector<classes_c*> classes;
};

class synthetic_attribute : public attribute_info {
};


class local_variable_table_attribute : public attribute_info {
public:
	short local_variable_table_length;
	class local_variable_table_c{
	public:
		short start_pc;
		short length;
		short name_index;
		short descriptor_index;
		short index;
	};
	vector<local_variable_table_c*> local_variable_table;
};

class deprecated_attribute : public attribute_info {
};

#endif